export interface TreeFromArrayConfig {
  props?: {
    prop?: string
    parentProp?: string
    parentValue?: string
    childrenProp?: string
  }

  mapping?: (node: Record<string, any>) => Record<string, any>
}

export declare type TreeFromArray = {
  <T extends Record<string, any>>(array: T[]): T[]
  <T extends Record<string, any>>(array: T[], config: TreeFromArrayConfig): T[]
}

// 数组转树型结构
export const treeFromArray: TreeFromArray = <T extends Record<string, any>>(array: T[], config?: TreeFromArrayConfig) => {
  return array
}